<template>
	<!-- 拒绝退货 & 修改理由 弹窗 -->
	<view class="item-info" :class="openShow === 0 ? 'none' : openShow === 1 ? 'show' : ''">
		<view class="cate-content">
			<view class="item-fixed-top">
				<view class="title">{{title}}</view>
				<view class="close"  @click="close">
					<image src="../../static/images/close.png" mode="scaleToFill"></image>
				</view>
			</view>
			<view class="cate-list">
				<swiper class="c-info" :current="curIndex" :autoplay="autoplay" circular="true" @change="onSwiper"
						indicator-dots="true" indicator-color="rgba(0, 0, 0, .2)" indicator-active-color="#38F">
					<swiper-item v-for="(item, index) in imgUrl" :key="index" class="client-img">
						<image :src="item" mode="aspectFit" 
						@mouseover="onMouseOverHandler"
						@mouseout="onMouserOut"></image>
					</swiper-item>
				</swiper>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title : "查看大图",
				openShow : 0,
				curIndex : 0,
				imgUrl : [],
				autoplay : true,
			};
		},
		methods: {
			//****   鼠标移入事件   ****//
			onMouseOverHandler()
			{
				this.autoplay = false;
			},
			
			//****   鼠标移出事件   ****//
			onMouserOut()
			{
				this.autoplay = true;
			},
			
			/**显示分类面板 type:0付款记录，1：操作记录**/
			toggleBillsStateMask(type,data,index) 
			{
				if(data)
				{
					this.imgUrl = data;
					this.curIndex = index;
				}
				let timer = type === 'show' ? 10 : 200;
				let state = type === 'show' ? 1 : 0;
				this.openShow = 2;
				setTimeout(() => {
					this.openShow = state;
				}, timer);
				// if(!type)
				// 	this.imgUrl = [];
				// 	this.curIndex = 0;
			},
			
			onSwiper(e)
			{
				
			},
			
			close()
			{
				this.toggleBillsStateMask();
			},
		},
	}
</script>
<style lang="scss">
.item-info {
	position: fixed;
	z-index: 9;
	left: 0;
	top: 0;
	bottom: 0;
	width: 100%;
	background: #FFF;
	transition: 0.3s;
	overflow-y: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	
	.cate-content {
		border-radius: 6px;
		overflow: hidden;
		width: 500px;
		background: #F8F8F8;
		float: right;
		transform: translateY(-100%);
		transition: 0.3s;
		position: relative;
		z-index: 9999;
		.item-fixed-top
		{
			height: 50px;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 14px;
			border-bottom: 1px solid #ECECEC;
			.title
			{
				font-size: 16px;
			}
			.close
			{
				position: absolute;
				right: 5px;
				top: 12px;
				width: 32px;
				height: 32px;
				text-align: center;
				cursor: pointer;
				image
				{
					width: 14px;
					height: 14px;
				}
			}
		}
	}

	&.none {
		display: none;
	}
	&.show {
		background: rgba(0, 0, 0, 0.3);
		.cate-content {
			transform: translateY(0);
		}
	}
}
.cate-list
{
	box-sizing: border-box;
	width: 500px;
	height: 100%;
	padding: 20px;
	position: relative;
	display: flex;
	align-items: center;
	.c-info
	{
		width: 100%;
		height: 60vh;
		display: flex;
		align-items: center;
		justify-content: center;
		text-align: center;
		border-radius: 10px;
		overflow: hidden;
		.client-img
		{
			width: 100%;
			height: 100%;
			image
			{
				width: 100%;
				height: 100%;
			}
		}
	}
	
}
</style>